export function SHALLOW_COPY_GLOBAL_STATE(state) {
  return {
    ...state
  }
}

export function FETCH_PAGE_DATA(state, payload) {
  state = TO_UPDATE_STH(state)
  return state
}

export function TO_UPDATE_STH(state, payload = {}) {
  return {
    ...state
  }
}

export function REVERSE_ORDERS(state) {
  let { orders } = state
  return {
    ...state,
    orders: orders.concat().reverse()
  }
}

export function INCR_NUM(state) {
  const { num } = state
  return {
    ...state,
    num: num + 1
  }
}

export function TO_UPDATE_PHASE_IN_WILL_MOUNT(state) {
  return SET_PHASE(state, { phase: 'will-mount' })
}

export function TO_UPDATE_PHASE_IN_DID_MOUNT(state) {
  return SET_PHASE(state, { phase: 'did-mount' })
}

export function SET_PHASE(state, { phase }) {
  return {
    ...state,
    phase,
  }
}

// specail actions
// may move to base-controller

export function UPDATE_STATE(state, newState) {
  return {
    ...state,
    ...newState,
  }
}

export const UPDATE_INPUT_VALUE = UPDATE_STATE